package com.jy.eduservice.controller;


import com.jy.commonutils.R;


import com.jy.eduservice.entity.subject.OneSubject;
import com.jy.eduservice.service.EduSubjectService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import java.util.List;

@RestController
@CrossOrigin
@RequestMapping("/eduservice/subject")
public class EduSubjectController {
    @Autowired
    private EduSubjectService eduSubjectService;

    @PostMapping("/addSubject")
    public R addSubjedt(MultipartFile file){
        eduSubjectService.saveSubject(file,eduSubjectService);
        return  R.ok();
    }

    //课程分类列表展示(树形)
    @GetMapping("getAllSubject")
    public R getAllSubject(){
        List<OneSubject> list=eduSubjectService.getAllOneTwoSubject();
        return R.ok().data("list",list);
    }


}
